Empty files generated from running `mysqldump` using PHP

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2009-04-15T00:07:37Z Indexed on 2010/05/24 7:11 UTC
Read the original article Hit count: 140

Filed under:
|

I keep getting empty files generated from running

$command = 'mysqldump --opt -h localhost -u username -p \'password\' dbname > \'backup 2009-04-15 09-57-13.sql\'';

command($command);

Anyone know what might be causing this? My password has strange characters in it, but works fine with connecting to the db.

I've ran exec($command, $return) and outputted the $return array and it is finding the command. I've also ran it with mysqldump > file.sql and the file contains

Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

So it would seem like the command is working.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql